package dimension.starry.mixin;

import dimension.starry.event.Events;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(value = ItemEntity.class, priority = 1001)
public class ItemEntityMixin {

    @Inject(method = "onPlayerCollision", at = @At(value = "HEAD"))
    public void onPickupItem(PlayerEntity player, CallbackInfo ci) {
        ItemEntity itemEntity = (ItemEntity) (Object) this;
        Events.PLAYER_PICKUP_ITEM_EVENT.invoker().onPlayerPickupItem(player, itemEntity);
    }

}
